package com.example.activelifecycletest.login;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.example.activelifecycletest.R;

/**
 * 登录主体类
 * @author zhangding
 * @date 2022年04月22日10:44:04
 */
public class LoginMainActivity extends BaseActivity{
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_main);
        Button forceOffline = (Button) findViewById(R.id.force_offline);
        forceOffline.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent("FORCE_OFFLINE");
                Log.d("zhang",ForceOfflineReceiver.class.getName());
                // TODO:为什么在xml里面注册的需要加上这行代码指定广播类，在java代码中注册的加上这行就会报错
                //intent.setComponent(new ComponentName(getPackageName(),"com.example.activelifecycletest.login.ForceOfflineReceiver"));
                sendBroadcast(intent);
            }
        });
    }
}
